<template>
  <div>
    <el-select
      v-model="ids"
      :multiple="true"
      style="width: 100%"
      @change="handleChange"
      :placeholder="$t('labels.pleaseSelect')"
    >
      <el-option
        v-for="item in datas"
        :key="item.value"
        :label="item.label"
        :value="item.value"
      >
      </el-option>
    </el-select>
  </div>
</template>
<script>
export default {
  data() {
    return {
      datas: [],
      values: null,
    };
  },
  model: {
    prop: "types",
    event: "change",
  },
  methods: {
    getData() {
      this.datas = [
        {
          label: "authorization code",
          value: "gt:authorization_code",
        },
        {
          label: "client credentials",
          value: "gt:client_credentials",
        },
        {
          label: "implicit",
          value: "gt:implicit",
        },
        {
          label: "password",
          value: "gt:password",
        },
        {
          label: "refresh token",
          value: "gt:refresh_token",
        },
      ];
    },
    handleChange() {
      this.$emit("change", this.values);
    },
  },
  watch: {},
  mounted() {
    this.values = this.types;
    this.$nextTick(() => {
      this.getData();
    });
  },
  props: {
    types: {
      type: String,
      default: "",
    },
  },
};
</script>
